
call setenv 2>NUL

if ""%1""=="""" goto doneSetArgs
set CATALINA_HOME=%1
shift
if ""%1""=="""" goto doneSetArgs
set WAR_APP=%1
shift
if ""%1""=="""" goto doneSetArgs
set WAR_FILE=%1
:doneSetArgs

if exist "%CATALINA_HOME%\bin\catalina.bat" goto ok1
echo The CATALINA_HOME environment variable is not defined correctly
pause
goto end

:ok1
if not ""%WAR_APP%""=="""" goto ok2
echo The WAR_APP environment variable is not defined
pause
goto end

:ok2

rmdir /s/q %CATALINA_HOME%\work\Catalina\localhost
rmdir /s/q %CATALINA_HOME%\conf\Catalina\localhost
del     /q %CATALINA_HOME%\logs\*.*
del     /q %CATALINA_HOME%\webapps\*.war
rmdir /s/q %CATALINA_HOME%\webapps\%WAR_APP%

:end
